import {defineConfig} from "vite";
import vue from "@vitejs/plugin-vue"
import path, { resolve } from "path";
import dts from "vite-plugin-dts"
import cssInjectedByJs from "vite-plugin-css-injected-by-js"
import { viteStaticCopy } from 'vite-plugin-static-copy';

export default defineConfig({
    plugins:
    [
        vue(),
        dts({tsconfigPath: "./tsconfig.json"}),
        cssInjectedByJs(),
        viteStaticCopy(
            {
            targets:
                [
                    {
                        src: 'src/assets/**/', dest: 'dist/assets/'
                    }
                ]
            }
        )
    ],
    build: {
        lib: {
            entry: resolve(__dirname, "src/index.ts"),
            name: "CustomButtonComponent",
            fileName: "index"
        },
        rollupOptions: {
            external: ['vue'],
            output: {
                globals: {
                    vue: 'Vue'
                }
            }
        }
    },
    resolve: {
        alias: {
            '@': path.resolve(__dirname, "src")
        }
    }
});